package com.onemile.net;

import com.onemile.data.DXml;
import com.onemile.entity.Session;

import android.os.AsyncTask;
import android.util.Log;

public class NetFavoriteCancelTask extends AsyncTask<String, Integer, DXml>
{

   private TaskCallBack mCallBack;

   public NetFavoriteCancelTask(TaskCallBack callBack)
   {
	  mCallBack = callBack;
   }

   @Override
   protected DXml doInBackground(String... params)
   {
	  try
	  {
		  return NetClient.CancelFavorite(params[0]);
	  }
	  catch (Exception e)
	  {
		 if (Session.getInstance().IsDEBUG())
		 {
			Log.e("ERROR", "NetFavoriteCancelTask_doInBackground(params) ", e);
		 }
	  }
	  return null;
   }

   @Override
   protected void onPostExecute(DXml result)
   {
	  try
	  {
        mCallBack.DoWhenComplete(result);
	  }
	  catch (Exception e)
	  {
		 if (Session.getInstance().IsDEBUG())
		 {
			Log.e("ERROR", "NetFavoriteCancelTask_onPostExecute(result) ", e);
		 }
	  }
   }

   public interface TaskCallBack
   {
	  public void DoWhenComplete(DXml result);
   }

}
